package com.panda.client;

import com.panda.entity.Role;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 乐于吕
 * * @date 2024/10/16
 * 该接口可以维护user服务向role服务发送的请求接口
 */

//RoleClient  类似http客户端


//openfeign的客户端
// name：指定调用哪个服务，即服务名
@FeignClient(name = "ROLESERVICE")  //localhost：8544
public interface RoleClient {

    //请求映射
    @RequestMapping("/role/m1")
    //localhost：8544/role/m1
    String method1();

    @GetMapping("/role/m2")
    String method2(@RequestParam("id") Integer id);

    @GetMapping("/role/m3/{id}")
    String method3(@PathVariable("id") Integer id);

//    http://localhost:8544/role/m4?id=1&roleName=2$description=管理员
    @GetMapping("/role/m4")
    String method4(@RequestParam("id") Integer id , @RequestParam("roleName")String roleName ,@RequestParam("description") String description);

    @PostMapping("/role/m5")
    String method5(@RequestBody Role role);

    @PostMapping("/role/m6")
    String method6(@RequestBody String[] ids);

    @PostMapping("/role/m7")
    String method71();

    @PostMapping("/role/m7")
    Role method72();

    @PostMapping("/role/m8")
    List<Role> method8();


}
